﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SensorDetection
{
    class TestObserver : IObserver
    {
        //private List<Sensor> s = new List<Sensor>();
        //private Sensor s;
        //Needed ever?
        /*public TestObserver(Sensor aSensor)
        {
            s = aSensor;
        }*/
        #region IObserver Members
        public void Update(string sender, object msg)
        {
            if (msg == null)
            {
                Console.WriteLine("The {0} detected nothing", sender);
            }
            else
            {
                if (msg.GetType().ToString().StartsWith("System.Collections.Generic.List"))
                {
                    Console.WriteLine("{0}",sender);
                    //foreach (object o in msg)
                        //Console.WriteLine(o.ToString());
                }
                else if (Object.ReferenceEquals("test".GetType(), msg.GetType()))
                    Console.WriteLine("{0} sends {1}", sender, (string)msg);
            }
        }
        #endregion
    }
}
